<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>promise.allSettled</title>
  </head>
  <body></body>
  <script>
    //无论是resolved,还是reject状态，promise.allSettled都接受，永远都是正确的
    let houdunren = new Promise((resolve, reject) => {
      setTimeout(() => {
        // resolve("第一个异步");
        reject("fail");
      }, 1000);
    });
    let hdcms = new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve("第二个异步");
      }, 1000);
    });
    Promise.allSettled([houdunren, hdcms]).then((result) => {
      console.log(result);
    });
  </script>
</html>
